﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DataAccessLayer
{
   
    public class GenerateReportDAL
    {
        StationeryInventoryEntities1 ent;
        public GenerateReportDAL()
        {
            ent = new StationeryInventoryEntities1(); 
        }

        public List<Role> getEmpList()
        { 
            List<Role> empLst = (from x in ent.Roles select x).ToList();
            return empLst;
        }

        public List<object> getDeptByQty(int m, int y)
        {
            var lst = ent.sp_EachDeptByQty(m, y);
            
            return lst.ToList<object>();
        }
        public List<object> getDeptByQtyTwo(int m1, int y1, int m2, int y2)
        {
            var lst = ent.sp_EachDeptByQtyTwo(m1, y1, m2, y2);
            return lst.ToList<object>();
        }
        public List<object> getDeptByQtyThree(int m1, int y1, int m2, int y2, int m3, int y3)
        {
            var lst = ent.sp_EachDeptByQtyThree(m1, y1, m2, y2, m3, y3);
            return lst.ToList<object>();
        }
        //for Dept by Price
        public List<object> getDeptByPrice(int m1, int y1)
        {
            var lst = ent.sproc_DeptByPrice(m1, y1);
            return lst.ToList<object>();

        }
        public List<object> getDeptByPriceTwo(int m1, int y1, int m2, int y2)
        {
            var lst = ent.sproc_DeptByPriceTwo(m1, y1, m2, y2);
            return lst.ToList<object>();

        }
        public List<object> getDeptByPriceThree(int m1, int y1, int m2, int y2, int m3, int y3)
        {
            var lst = ent.sproc_DeptByPriceThree(m1, y1, m2, y2, m3, y3);
            return lst.ToList<object>();

        }
        //end Dept by Price
        
        //for Category by Qty
        public List<object> getCatByQty(int m1, int y1)
        {
            var lst = ent.sproc_CatByQty(m1, y1);
            return lst.ToList<object>();

        }
        public List<object> getCatByQtyTwo(int m1, int y1,int m2, int y2)
        {
            var lst = ent.sproc_CatByQtyTwo(m1, y1, m2, y2);
            return lst.ToList<object>();

        }
        public List<object> getCatByQtyThree(int m1, int y1, int m2, int y2, int m3, int y3)
        {
            var lst = ent.sproc_CatByQtyThree(m1, y1,m2, y2, m3, y3);
            return lst.ToList<object>();

        }
        //end Category by Qty


        //for Category by Price
        public List<object> getCatByPrice(int m1, int y1)
        {
            var lst = ent.sproc_CatByPrice(m1, y1);
            return lst.ToList<object>();

        }
        public List<object> getCatByPriceTwo(int m1, int y1, int m2, int y2)
        {
            var lst = ent.sproc_CatByPriceTwo(m1, y1, m2, y2);
            return lst.ToList<object>();

        }
        public List<object> getCatByPriceThree(int m1, int y1, int m2, int y2, int m3, int y3)
        {
            var lst = ent.sproc_CatByPriceThree(m1, y1, m2, y2, m3, y3);
            return lst.ToList<object>();

        }


        
        //    var lst = (from r in ent.DeptRequisitions
        //                join s in ent.DeptRequisitionDetails
        //                    on r.DeptReqID equals s.DeptReqID
        //                group new { r,s } by new { r.DeptID, r.Department.DeptName }
        //                into grp
        //                select new
        //                {
        //                    grp.Key.DeptID,
        //                    grp.Key.DeptName,
                            
        //                }
        //              )

        //        (from x in ent.DeptRequisitions 
        //               join y in ent.DeptRequisitionDetails
        //               on x.DeptReqID equals y.DeptReqID
        //               where x.StartDate > startDate
        //               && x.EndDate < endDate
        //               group x by new {x.DeptID,x.Department.DeptName}
        //               into grp
        //               select new
        //               {
        //                    grp.Key.DeptID,
        //                    grp.Key.DeptName,


                            
                            
        //               }
        //         )

        //}
    }
}
